        var collapsedPrefix = '[+]';
        var expandededPrefix = '[-]'; 
        var prefixLenght = 3;//collapsedPrefix.value.length;
 // see also http://api.jqueryui.com/accordion/
       $(function () //doc ready
        {  
            $("a[href='']").click(function(e) 
            {
                //var str = $(this).attr("href");
                //if (str == null || !str || !str.trim())
                //{
                //alert('preventDefault');
                e.preventDefault();
                //alert($(this).text());
                window.external.ClientCallback($(this).text());
             }                      );//a[href='']").click ends
     
                //DisablePatternLinks();
                //ChangeAppearance('show', 'first');
                //CreateCollapsableTopics();
        });//ready ends
               
        //global functions
        function CreateCollapsableTopics()
        {
            $('.section').each(function () 
            {
                 var otext = $('h2', this).text().trim();
                $('h2', this).remove();//replace the header with a widget
                $('<div class="ui-widget-header" style="width:auto">' + collapsedPrefix + otext + '</div>')
                .insertBefore(this).click(function () {$(this).next().slideToggle(200);
							//alert("$this text= " + $(this).text() + " otext= " + otext);
							var prefix = $(this).text().trim().substring(0,prefixLenght);
							//alert('prefix:' + prefix);
							if(prefix == collapsedPrefix)
							    $(this).text(expandededPrefix + otext);
							if(prefix == expandededPrefix)
							    $(this).text(collapsedPrefix + otext);							    
						       })
                .mouseover(function () {$(this).css('cursor', 'pointer');})
                .next().hide();
            }                   );//.section').each ends
        }
        
        function DisablePatternLinks()
        {
            $("a[href='']")
               .each(function()
               { 
                    var txt =$(this).text();
                    //alert(txt);
                    $(this).replaceWith(function(){ return  txt.trim() ;});    
                });
        }
        
	    function ChangeAppearance(action, target, collapse, expand, len) 
	    {
	        collapsedPrefix = collapse;
            expandededPrefix = expand;
            prefixLenght = len;
	        //alert('alert:' + action + ' target:' + target); 
            if(target == 'none')
            {
               // alert('no target, no collapsible'); 
                return;
            }
            else
            {
                CreateCollapsableTopics();
            }
		    if(target == 'first')
		    {
		        //var firstElem = $('.section:first').prev();//creates cloned extra node
		        if(action == 'hide')
		        {
				    $('.section:first').hide();	
				    var txt = $('.section:first').prev().text().trim().substring(prefixLenght);
				    $('.section:first').prev().text(collapsedPrefix + txt);				    
				}	    
		        else
		        {
				    $('.section:first').show();
				    var txt = $('.section:first').prev().text().trim().substring(prefixLenght);
				    //alert ('text setting for first expansion:' + expandededPrefix + txt);
				    $('.section:first').prev().text(expandededPrefix + txt);
				}
		    }
		    else if(target == 'last')
		    {
	            if(action == 'hide')
			        $('.section:last').hide();		    
	            else
			        $('.section:last').show();					
	        }
		    else
		    {
			    $('.section').each(function () 
			    {
				    if(action == 'hide')
					    $(this).hide();
				    else
				    {
					    $(this).show();
				    var txt = $(this).prev().text().trim().substring(prefixLenght);
				    //alert ('text setting for any expansion:' + expandededPrefix + txt);
				    $(this).prev().text(expandededPrefix + txt);					     
					}

			    }                 );
		    }
	    }